package cn.cuilan.service;

import cn.cuilan.entity.PositionCity;
import cn.cuilan.repository.PositionCityRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 城市（县）服务层实现类
 *
 * @author zhangyue
 */
@Service
public class PositionCityService {

    private final PositionCityRepository positionCityRepository;

    @Autowired
    public PositionCityService(PositionCityRepository positionCityRepository) {
        this.positionCityRepository = positionCityRepository;
    }

    /**
     * 根据地区 id 查询所有城市（县）
     *
     * @param areaId 地区id
     * @return 地理位置城市集合
     */
    public List<PositionCity> findCityByAreaId(int areaId) {
        return positionCityRepository.findByAreaId(areaId);
    }

}
